package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.*;
import com.sky.entity.Orders;
import com.sky.vo.OrderOverViewVO;
import com.sky.vo.SetmealOverViewVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.lang.NonNull;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;


@Mapper
public interface OrderMapper {

    void insert(Orders order);

    @Select("select * from orders where id = #{id}")
    Orders getById(Long id);

    void updateById(Orders newOrders);

    Page<Orders> pageQuery(OrdersPageQueryDTO ordersPageQueryDTO);

    @Select("select * from orders where number = #{number}")
    Orders getByNumber(String outTradeNo);

//    void update(Orders orders);


    @Select(" select count(1) from orders where status = #{status}")
    Integer countByStatus(Integer status);

    List<Orders> getByStatusAndOrderTimeLT(Integer status, LocalDateTime orderTime);

    List<TurnoverDateStatistic> getAmountEveryDay(LocalDate begin, LocalDate end);

    List<OrderDataStatistic> getOrdersEveryDay(LocalDate begin, LocalDate end);

    List<GoodsSalesDTO> getSalesTop10(LocalDateTime begin, LocalDateTime end);

    OrderOverViewVO getOverviewOrders(LocalDateTime begin, LocalDateTime end);

    BusinessOrderData getBusinessOrderData(LocalDateTime begin, LocalDateTime end);

    List<BusinessOrderData> getBusinessOrderDataIsEveryDay(@NonNull LocalDateTime begin, @NonNull LocalDateTime end,@NonNull Integer isEveryDay);

}
